package cn.lml.lession.user.service.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.lml.lession.user.dao.RoleMapper;
import cn.lml.lession.user.model.Role;
import cn.lml.lession.user.service.RoleService;

@Service
public class RoleServiceImpl implements RoleService{

	private static final Logger logger=LoggerFactory.getLogger(RoleServiceImpl.class);	
	@Autowired
	private RoleMapper roleMapper;

	@Override
	public Integer insertRole (Role role){
		logger.debug("新增数据 "+role);
		return roleMapper.insertRole(role);
	}

	@Override
	public Integer deleteByRid (Integer rid){
		logger.debug("通过Rid删除数据 "+rid);
		return roleMapper.deleteByRid(rid);
	}

	@Override
	public Integer updateByRid (Role role){
		logger.debug("通过Rid修改数据 "+role);
		return roleMapper.updateByRid(role);
	}

	@Override
	public Role selectByRid (Integer rid){
		logger.debug("通过Rid查找数据 "+rid);
		return roleMapper.selectByRid(rid);
	}

	@Override
	public List<Role> queryRole(Map<String, Object> cond) {
		logger.debug("分页查询数据 "+cond);
		return roleMapper.queryRole(cond);
	}

	@Override
	public Integer countRole(Map<String, Object> cond) {
		logger.debug("统计数据 "+cond);
		return roleMapper.countRole(cond);
	}

	@Override
	public List<Role> queryRoleByUserId(Integer uid) {
		return roleMapper.queryRoleByUserId(uid);
	}

}